#include <stdio.h>
int sum(int, int);
int main()
{
    int k, m, n;
    scanf("%d", &k);
    while(k--){
        scanf("%d %d", &m, &n);
        printf("%d\n", sum(m, n));
    }

    return 0;
}
int sum(int m, int n){
    int sum = 0;
    while( n - m >= 0){
        sum += m++;
    }
    return sum;
}